/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author David
 */
@Entity
@Table(name = "unitats_mesura")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UnitatsMesura.findAll", query = "SELECT u FROM UnitatsMesura u"),
    @NamedQuery(name = "UnitatsMesura.findById", query = "SELECT u FROM UnitatsMesura u WHERE u.id = :id"),
    @NamedQuery(name = "UnitatsMesura.findByNom", query = "SELECT u FROM UnitatsMesura u WHERE u.nom = :nom"),
    @NamedQuery(name = "UnitatsMesura.findByPlantar", query = "SELECT u FROM UnitatsMesura u WHERE u.plantar = :plantar"),
    @NamedQuery(name = "UnitatsMesura.findByCollir", query = "SELECT u FROM UnitatsMesura u WHERE u.collir = :collir"),
    @NamedQuery(name = "UnitatsMesura.findByAbonoPaquet", query = "SELECT u FROM UnitatsMesura u WHERE u.abonoPaquet = :abonoPaquet"),
    @NamedQuery(name = "UnitatsMesura.findByAbonoQuantitat", query = "SELECT u FROM UnitatsMesura u WHERE u.abonoQuantitat = :abonoQuantitat"),
    @NamedQuery(name = "UnitatsMesura.findByFitosanDisolucio", query = "SELECT u FROM UnitatsMesura u WHERE u.fitosanDisolucio = :fitosanDisolucio"),
    @NamedQuery(name = "UnitatsMesura.findByFitosanDosis", query = "SELECT u FROM UnitatsMesura u WHERE u.fitosanDosis = :fitosanDosis")})
public class UnitatsMesura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nom")
    private String nom;
    @Basic(optional = false)
    @Column(name = "plantar")
    private boolean plantar;
    @Basic(optional = false)
    @Column(name = "collir")
    private boolean collir;
    @Basic(optional = false)
    @Column(name = "abono_paquet")
    private boolean abonoPaquet;
    @Basic(optional = false)
    @Column(name = "abono_quantitat")
    private boolean abonoQuantitat;
    @Basic(optional = false)
    @Column(name = "fitosan_disolucio")
    private boolean fitosanDisolucio;
    @Basic(optional = false)
    @Column(name = "fitosan_dosis")
    private boolean fitosanDosis;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "unitatsMesuraId")
    private Collection<Produccio> produccioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "unitatsDisolucio")
    private Collection<Fitosanitari> fitosanitariCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "unitatsDosis")
    private Collection<Fitosanitari> fitosanitariCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "unitatsMesuraId")
    private Collection<Collita> collitaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "unitatsQuantitat")
    private Collection<Abono> abonoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "unitatsPaquet")
    private Collection<Abono> abonoCollection1;
    @OneToMany(mappedBy = "unitatsMesuraId")
    private Collection<UnitatsMesura> unitatsMesuraCollection;
    @JoinColumn(name = "unitats_mesura_id", referencedColumnName = "id")
    @ManyToOne
    private UnitatsMesura unitatsMesuraId;

    public UnitatsMesura() {
    }

    public UnitatsMesura(Integer id) {
        this.id = id;
    }

    public UnitatsMesura(Integer id, String nom, boolean plantar, boolean collir, boolean abonoPaquet, boolean abonoQuantitat, boolean fitosanDisolucio, boolean fitosanDosis) {
        this.id = id;
        this.nom = nom;
        this.plantar = plantar;
        this.collir = collir;
        this.abonoPaquet = abonoPaquet;
        this.abonoQuantitat = abonoQuantitat;
        this.fitosanDisolucio = fitosanDisolucio;
        this.fitosanDosis = fitosanDosis;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public boolean getPlantar() {
        return plantar;
    }

    public void setPlantar(boolean plantar) {
        this.plantar = plantar;
    }

    public boolean getCollir() {
        return collir;
    }

    public void setCollir(boolean collir) {
        this.collir = collir;
    }

    public boolean getAbonoPaquet() {
        return abonoPaquet;
    }

    public void setAbonoPaquet(boolean abonoPaquet) {
        this.abonoPaquet = abonoPaquet;
    }

    public boolean getAbonoQuantitat() {
        return abonoQuantitat;
    }

    public void setAbonoQuantitat(boolean abonoQuantitat) {
        this.abonoQuantitat = abonoQuantitat;
    }

    public boolean getFitosanDisolucio() {
        return fitosanDisolucio;
    }

    public void setFitosanDisolucio(boolean fitosanDisolucio) {
        this.fitosanDisolucio = fitosanDisolucio;
    }

    public boolean getFitosanDosis() {
        return fitosanDosis;
    }

    public void setFitosanDosis(boolean fitosanDosis) {
        this.fitosanDosis = fitosanDosis;
    }

    @XmlTransient
    public Collection<Produccio> getProduccioCollection() {
        return produccioCollection;
    }

    public void setProduccioCollection(Collection<Produccio> produccioCollection) {
        this.produccioCollection = produccioCollection;
    }

    @XmlTransient
    public Collection<Fitosanitari> getFitosanitariCollection() {
        return fitosanitariCollection;
    }

    public void setFitosanitariCollection(Collection<Fitosanitari> fitosanitariCollection) {
        this.fitosanitariCollection = fitosanitariCollection;
    }

    @XmlTransient
    public Collection<Fitosanitari> getFitosanitariCollection1() {
        return fitosanitariCollection1;
    }

    public void setFitosanitariCollection1(Collection<Fitosanitari> fitosanitariCollection1) {
        this.fitosanitariCollection1 = fitosanitariCollection1;
    }

    @XmlTransient
    public Collection<Collita> getCollitaCollection() {
        return collitaCollection;
    }

    public void setCollitaCollection(Collection<Collita> collitaCollection) {
        this.collitaCollection = collitaCollection;
    }

    @XmlTransient
    public Collection<Abono> getAbonoCollection() {
        return abonoCollection;
    }

    public void setAbonoCollection(Collection<Abono> abonoCollection) {
        this.abonoCollection = abonoCollection;
    }

    @XmlTransient
    public Collection<Abono> getAbonoCollection1() {
        return abonoCollection1;
    }

    public void setAbonoCollection1(Collection<Abono> abonoCollection1) {
        this.abonoCollection1 = abonoCollection1;
    }

    @XmlTransient
    public Collection<UnitatsMesura> getUnitatsMesuraCollection() {
        return unitatsMesuraCollection;
    }

    public void setUnitatsMesuraCollection(Collection<UnitatsMesura> unitatsMesuraCollection) {
        this.unitatsMesuraCollection = unitatsMesuraCollection;
    }

    public UnitatsMesura getUnitatsMesuraId() {
        return unitatsMesuraId;
    }

    public void setUnitatsMesuraId(UnitatsMesura unitatsMesuraId) {
        this.unitatsMesuraId = unitatsMesuraId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UnitatsMesura)) {
            return false;
        }
        UnitatsMesura other = (UnitatsMesura) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.UnitatsMesura[ id=" + id + " ]";
    }
    
}
